package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;

public class OutputStreamWriterDemo01 {
    public static void main(String[] args) throws IOException {
        //1.构建字符转换输出流对象
        OutputStreamWriter osw =
                new OutputStreamWriter(
                        new FileOutputStream("osw.txt"),
                        StandardCharsets.UTF_8);
        //2.写数据（字符串）
        osw.write("和我在成都的街头走一走，哦哦~~"); //art+enter
        osw.write("直到所有的灯都熄灭了，也不停留。");
        System.out.println("写出完毕");
        //3.关闭流对象
        osw.close();
    }
}
